#include <limits.h>
#include "gtest/gtest.h"
#include "../include/FileDataSource.h"

#define MBYTE 1024*1024
// Tests factorial of negative numbers.
TEST(FileDataSourceTest,CanReadStatusFile) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	FileDataSource dataSource("c:/json");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nRet=dataSource.GetStatusJson(pJsonBuf,nBufferSize);


	EXPECT_EQ(0,nRet);
	EXPECT_EQ(55,nBufferSize);
}

TEST(FileDataSourceTest,CanReadSlotsFile) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	FileDataSource dataSource("c:/json");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nRet=dataSource.GetSlotsJson(pJsonBuf,nBufferSize);


	EXPECT_EQ(0,nRet);
	EXPECT_EQ(247,nBufferSize);
}

TEST(FileDataSourceTest,CanReadAdListFile) {
	// This test is named "Negative", and belongs to the "FactorialTest"
	// test case.
	FileDataSource dataSource("c:/json");
	char* pJsonBuf=new char[10*MBYTE];
	int nBufferSize=MBYTE*10;
	int nRet=dataSource.GetAdListJson(1,10,pJsonBuf,nBufferSize);


	EXPECT_EQ(0,nRet);
	EXPECT_EQ(1859,nBufferSize);
}